home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 13719 < prev    next >
Encoding:
Text File  |  1996-08-05  |  2.2 KB  |  61 lines

  1. Path: tank.news.pipex.net!pipex!swrinde!gatech!psinntp!psinntp!psinntp!pipeline!not-for-mail
  2. From: johndill@nyc.pipeline.com (John Dillworth)
  3. Newsgroups: comp.lang.c,
  4. Subject: Dispaly lines of Lines of file with Win 3.1 SDK
  5. Date: 9 Apr 1996 16:19:47 -0400
  6. Organization: Pipeline
  7. Message-ID: <4kegp3$d5p@pipe11.nyc.pipeline.com>
  8. NNTP-Posting-Host: pipe11.nyc.pipeline.com
  9. X-PipeUser: johndill
  10. X-PipeHub: nyc.pipeline.com
  11. X-PipeGCOS: (John Dillworth)
  12. X-Newsreader: Pipeline v3.5.0
  13.  
  14. This is a fragment from a program included in the Microsoft development
  15. library and in Petzolds ôPrograming Windows 3.1.  The MAXENV is defined as
  16. 4096.   What this program does is display a box with the envirormental
  17. variables listed (PATH, PROMPT ect.....)  When you click on one of these
  18. variables the actula PATH or PROMPT willl appear in a window above the box
  19. that shows the variables.  My question:  How do I modify this to do the
  20. same think for my config.sys file.  I think that this can be done in real C
  21. (I refuse to accept that the developers of C could have imaged what Windows
  22. would do with it)  Can I use a function called ôFileOen and FileClose? 
  23. Will DrawText  suffice to display? 
  24.  
  25.  
  26.  
  27.  
  28.  
  29.                for (n = 0 ; environ[n] ; n++) 
  30.                     { 
  31.                     if (strlen (environ [n]) > MAXENV) 
  32.                          continue ; 
  33.                     *strchr (strcpy (szBuffer, environ [n]), '=') = '\0' ; 
  34.                     SendMessage (hwndList, LB_ADDSTRING, 0, 
  35.                                  (LONG) (LPSTR) szBuffer) ; 
  36.                     } 
  37.                return 0 ; 
  38.  
  39.           case WM_SETFOCUS: 
  40.                SetFocus (hwndList) ; 
  41.                return 0 ; 
  42.  
  43.           case WM_COMMAND: 
  44.                if (wParam == 1 && HIWORD (lParam) == LBN_SELCHANGE) 
  45.                     { 
  46.                     n = (WORD) SendMessage (hwndList, LB_GETCURSEL, 0, 0L)
  47.                     n = (WORD) SendMessage (hwndList, LB_GETTEXT, n, 
  48.                                             (LONG) (LPSTR) szBuffer) ; 
  49.  
  50.                     strcpy (szBuffer + n + 1, getenv (szBuffer)) ; 
  51.                     *(szBuffer + n) = '=' ; 
  52.  
  53.                     SetWindowText (hwndText, szBuffer) ; 
  54.                     } 
  55.                return 0 ; 
  56.  
  57. -- 
  58.  
  59. John Dillworth
  60.